/**
 * TODO
 *
 * @author kfzx-weiwf
 */
package com.icbc.api;

import com.icbc.api.request.SettlementAccountEarnestAcceptRequestV1;
import com.icbc.api.response.SettlementAccountEarnestAcceptResponseV1;
import com.nervenets.Global;

/**
 * TODO
 *
 * @author kfzx-weiwf
 */
public class EaccountManageTestV1 {
    private static final String APP_ID = Global.getApplicationProperties().getProperty("app.id");// "10000000000000002826";
    private static final String MY_PRIVATE_KEY = Global.getApplicationProperties().getProperty("my.private.key");
    private static final String APIGW_PUBLIC_KEY = Global.getApplicationProperties().getProperty("apigw.public.key");
    private static final String ENCRYPT_KEY = "xMh0xFsG7G80ziePFdnT8g==";


    public static void main(String[] args) throws IcbcApiException {
        DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, MY_PRIVATE_KEY, APIGW_PUBLIC_KEY);
        SettlementAccountEarnestAcceptRequestV1 request = new SettlementAccountEarnestAcceptRequestV1();
        SettlementAccountEarnestAcceptRequestV1.SettlementAccountEarnestAcceptRequestV1Biz bizContent = new SettlementAccountEarnestAcceptRequestV1.SettlementAccountEarnestAcceptRequestV1Biz();
        request.setServiceUrl("https://apipcs3.dccnet.com.cn/api/settlement/account/earnestaccept/V1");
        bizContent.setCorpNo("corpInst1234"); //合作方机构编号
        bizContent.setTrxAccDate("2017-03-14"); //合作方交易日期
        bizContent.setTrxAccTime("00:00:00"); //合作方交易时间
        bizContent.setCorpDate("2017-03-14"); //合作方工作日期
        bizContent.setCorpSerno("20202020"); //合作方交易单号
        bizContent.setOutServiceCode("earnestaccept"); //外部服务代码
        bizContent.setMediumId("6214760200000022233"); //工行联名卡号
        bizContent.setName("张三"); //客户户名
        bizContent.setBindMediumId("6222030200000600407"); //认筹资金卡号
        bizContent.setAccountNo("6222030200012340407"); // 定金接收账号
        bizContent.setAccountName("万科资金账号"); // 定金接收账号户名
        bizContent.setAccountBankNo("1234567891011"); // 定金接收账号行号
        bizContent.setAccountBankName("中国银行深圳分行"); // 定金接收账号行号名
        bizContent.setAccountBankFlag(1); // 定金接收账号行号别
        bizContent.setCcy(1); //币种
        bizContent.setAmount("300"); //交易金额
        bizContent.setHoldType(57); //保留种类
        bizContent.setHoldDate("2017-03-02"); //保留日期
        bizContent.setSummary("DY"); //摘要
        bizContent.setRemarks("DY"); //注释
        bizContent.setNotifyAddr("aaaaa"); //通知地址
        bizContent.setProjectNo("002504"); //项目编号
        bizContent.setSecretKey("h8ZujhDntpKRohwFmGXcnXygNjJHRQbyuVG3183uOdXI2fRgCXeDED9zOw5dO2JucVy7vZ19od7CSUxI2/sVOn6dPklVoaquVElgKRUPlr6D/cqLu25K7hJ3Pt/uOnx4qF/ykmO/IB2qS0rs/sp0Zw==");
        bizContent.setMediumIdHash("SDFDFHTEWTGDFWADADAFSDGSESEFD"); //卡号哈希值
        bizContent.setBindMediumHash("SDFDFHTEWTGDFWADADAFSDGSESEFD"); //认筹资金卡号哈希值
        bizContent.setAccountNoHash("SDFDFHTEWTGDFWADADAFSDGSESEFD"); // 定金接收账号哈希值
        request.setBizContent(bizContent);
        SettlementAccountEarnestAcceptResponseV1 response = client.execute(request, "msgId");
        if (response.isSuccess() && response.getReturnCode() == 0) {
            // 业务成功处理
            System.out.println(response.getEventNo());//
        } else {
            // 失败
            System.err.println(response.getReturnCode());//
            System.err.println(response.getReturnMsg());//
        }
    }
}

